﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace AxeFrog.Web
{
	[MetadataAttribute]
	[AttributeUsage(AttributeTargets.Class)]
	public class ExportControllerAttribute : ExportAttribute
	{
		public Type ControllerType { get; private set; }
		public string Name { get; private set; }

		public ExportControllerAttribute(Type controllerType)
			: base(typeof(IController))
		{
			ControllerType = controllerType;
			Name = controllerType.Name.EndsWith("Controller", StringComparison.InvariantCultureIgnoreCase) ?
				controllerType.Name.Substring(0, controllerType.Name.Length - "Controller".Length) : controllerType.Name;
		}
	}

	public interface IControllerMetadata
	{
		Type ControllerType { get; }
		string Name { get; }
	}
}